package com.googlecode.cswish.util;

import java.util.LinkedHashMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Provide a entry to debug the variable
 * 
 * @author feng Date: 2009-4-12
 */
public class TraceHashMap extends LinkedHashMap {
	
	private static final Log logger = LogFactory.getLog(TraceHashMap.class);
	
	private static String traceName;
	
	private static Object traceValue;
	
	public Object get(Object key) {
		Object value = super.get(key);
		if (traceName != null && traceName.equals(key)
				&& (traceValue == null && value == null || traceValue != null && traceValue.equals(value))) {
			logger.debug(value);
		}
		return value;
	}
}